package JAVACORE_TRAINING.OOPs.DOWNCASTING;

public class DowncastingWithInstanceOf {
	public static void main(String[] args) {
		//1. Khai báo & khởi tạo đối tượng
		Parent objP = new Child();
		
		//2. Thực thi nghiệp vụ
		Child.show(objP);
	}
	//Out put: Sucessfull Casting
}

class Parent{
}

class Child extends Parent{
	public void check()
    {
        System.out.println("Sucessfull Casting");
    }

    public static void show(Parent p)
    {
       if(p instanceof Child)
       {
           Child b1=(Child)p;
           b1.check();
       }
    }
}